{% extends "business/circuit_order.html" %}
{% block content %}

<table class="table table-hover table-condensed table-bordered">
    <thead>
        <tr>
            <td bgcolor="#C9C9C9">订单ID</td>
            <td bgcolor="#C9C9C9">线路编号</td>
            <td bgcolor="#C9C9C9">业务类型</td>
            <td bgcolor="#C9C9C9">业务带宽</td>
            <td bgcolor="#C9C9C9">当前状态</td>
            <td bgcolor="#C9C9C9">所属的客户名称</td>
            <td bgcolor="#C9C9C9">订单详情</td>
            <td bgcolor="#C9C9C9">操作</td>
        </tr>
    </thead>
    <tbody>
    {% for order in orders %}
        <tr class="success">
            <td><a href="{% url "show_circuit_order" order.id %}">{{ order.id }}</a></td>
            <td><a href="{% url "show_circuit_order" order.number %}">{{ order.number }}</a></td>
            <td>{{ order.type }}</td>
            <td>{{ order.status }}</td>
            <td>{{ order.bandwith }}</td>
            <td><a href="{% url "show_customer" order.customer_name %}">{{ order.customer_name }}</a></td>
            <td><a href="{% url "show_circuit_order" order.id %}">查看详情</a></td>
            <td><button type="button" class="btn btn-primary btn-xs" id="CircuitOrder_{{ order.id }}">删除</button></td>
        </tr>

        <script>
            $(function () {
                $("#CircuitOrder_{{ order.id }}").click(function () {
                    if(confirm("确定删除 线路编号: {{ order.number }} 的订单? 该订单的ticket信息也将被一起删除。")){
                        $.get("/business/del_circuit_order?circuit_order_id={{ order.id }}", function () {
                            window.location.replace("/business/circuit_order");
                        });
                    }
                })
            })
        </script>
    {% endfor %}
    </tbody>
</table>
{% endblock %}